<?php
$CI =& get_instance();
$sBasePath = public_base_url().'js/fckeditor/' ;
$CI->load->model("Model_mediaset", "model_mediaset");
$sets = $CI->model_mediaset->browse(null,null,null);
?>
<h2>Template Subsidiaries </h2>
<div class="content-inner">
	<table width="100%" border="0" cellpadding="0" cellspacing="0" class="form-table">
		<tbody>		
		<tr>
			<td>
			<?php $t1 = isset($ed['t1']) ? unserialize($ed['t1']) : null;?>
				<table width="100%" border="0" cellpadding="0" cellspacing="0" class="form-table">
				<tbody>
					<tr>
						<td class="label">Name</td>
						<td><input type="text" name="item_name" value="<?=$ed['name']?>" class="input-text"></td>
					</tr>
					<tr>
						<th class="label">Content</th>
						<td>
							<?=$this->ckeditor->editor("t1_content", $t1['content'], array("baseHref" => site_url()));?>
						</td>
					</tr>
					<tr>
						<th class="label">Gallery</th>
						<td>
					  		<?php $set_ids = $t1['set_ids']; $selected = false;?>
							<select name="t1_set_ids[]" size="3" class="input-text" multiple="true">
							  	<option value="">Please select</option>
							  	<?php foreach($sets as $item):?>
							  	<?php if(isset($t1['set_ids'])):?>
							  	<?php $selected = array_search($item['id'], $set_ids);?>
							  	<?php endif;?>
							    <option value="<?=$item['id']?>" <?=$selected!==FALSE ? "selected='true'" : "";?>><?=$item['title']?></option>
							    <?php endforeach;?>
							</select>
						</td>
					</tr>
					<tr>
				        <td class="space form">&nbsp;</td>
				        <td class="space">
				          <input type="hidden" name="id" value="<?=$ed['id']?>" />
				          <input type="hidden" name="item_temp" value="<?=$template_type?>" />
				          <input type="hidden" name="item_main" value="<?=$nav['id']?>" />
				          <input name="Submit" type="submit" class="ins" value="Save" />
				        </td>
			    	</tr>
				</tbody>
				</table>
			</td>
		</tr>
		</tbody>
	</table>
</div>